package com.lrs.java.j2se_self.io;

import java.io.*;
public class TestFileOutputStream {
	public static void main(String[] args){
		FileInputStream in = null;
		FileOutputStream out = null;
		int b = 0;
		try{
			in = new FileInputStream("D:/javawork6.0/eclipse Project/eclipse3.3/src/HelloWorld.java");
			out = new FileOutputStream("D:/javawork6.0/eclipse Project/eclipse3.3/src/io/HW.java");
		}catch(FileNotFoundException e){
			System.out.println("File not found!");
			System.exit(-1);
		}
		try{
			long m = 0;
			while((b=in.read())!=-1){
				out.write(b);
				//System.out.print((char)b);
			}
			in.close();
			out.close();
			
		}catch(FileNotFoundException e){
			System.out.println("file not found!");
			System.exit(-1);
		}catch(IOException e){
			System.out.println("文件复制错误!");
			System.exit(-1);
		}
		System.out.println("复制成功!");
	}
}


